        <!DOCTYPE html>
        <html>
        <head>
                <meta charset="utf-8">
        <title>PolygonContact class / box2d Library / Dart Documentation</title>
        <link rel="stylesheet" type="text/css"
            href="../styles.css">
        <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800" rel="stylesheet" type="text/css">
        <link rel="shortcut icon" href="../favicon.ico">
        
        </head>
        <body data-library="box2d" data-type="PolygonContact">
        <div class="page">
        <div class="header">
          <a href="../index.html"><div class="logo"></div></a>
          <a href="../index.html">Dart Documentation</a>
         &rsaquo; <a href="../box2d.html">box2d</a> &rsaquo; <a href="../box2d/PolygonContact.html">PolygonContact</a>        <div id="search-box">
          <input type="search" name="q" id="q" autocomplete="off"
              class="search-input" placeholder="Search API">
        </div>
        
      </div>
      <div class="drop-down" id="drop-down"></div>
      
        <div class="nav">
        
</div>
<div class="content">
        <h2><strong>PolygonContact</strong>
          class
        </h2>
        
<button id="show-inherited" class="show-inherited">Hide inherited</button>
<div class="doc">
<pre class="source">
class PolygonContact extends Contact {

 PolygonContact(DefaultWorldPool argPool) :
   super(argPool) { }

 void init(Fixture fA, Fixture fB) {
   expect(ShapeType.POLYGON, fA.type);
   expect(ShapeType.POLYGON, fB.type);
   super.init(fA, fB);
 }

 void evaluate(Manifold argManifold, Transform xfA, Transform xfB) {
   pool.collision.collidePolygons(argManifold, fixtureA.shape, xfA,
       fixtureB.shape, xfB);
 }
}
</pre>
</div>
<h3>Extends</h3>
<p>
<span class="type-box"><span class="icon-class"></span><a href="../box2d/Contact.html">Contact</a></span>&nbsp;&gt;&nbsp;<span class="type-box"><span class="icon-class"></span><strong>PolygonContact</strong></span></p>
<div>
<h3>Constructors</h3>
<div class="method"><h4 id="PolygonContact">
<button class="show-code">Code</button>
new <strong>PolygonContact</strong>(<a href="../box2d/DefaultWorldPool.html">DefaultWorldPool</a> argPool) <a class="anchor-link" href="#PolygonContact"
              title="Permalink to PolygonContact.PolygonContact">#</a></h4>
<div class="doc">
<pre class="source">
PolygonContact(DefaultWorldPool argPool) :
 super(argPool) { }
</pre>
</div>
</div>
</div>
<div class="inherited">
<h3>Properties</h3>
<div class="field inherited"><h4 id="edge1">
<button class="show-code">Code</button>
<a href="../box2d/ContactEdge.html">ContactEdge</a>         <strong>edge1</strong> <a class="anchor-link"
            href="#edge1"
            title="Permalink to PolygonContact.edge1">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
edge1
</pre>
</div>
</div>
<div class="field inherited"><h4 id="edge2">
<button class="show-code">Code</button>
<a href="../box2d/ContactEdge.html">ContactEdge</a>         <strong>edge2</strong> <a class="anchor-link"
            href="#edge2"
            title="Permalink to PolygonContact.edge2">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
edge2
</pre>
</div>
</div>
<div class="field inherited"><h4 id="enabled">
<button class="show-code">Code</button>
bool         <strong>enabled</strong> <a class="anchor-link"
            href="#enabled"
            title="Permalink to PolygonContact.enabled">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<p>Enable/disable this contact. This can be used inside the pre-solve
contact listener. The contact is only disabled for the current time step
(or sub-step in continuous collisions).</p>
<pre class="source">
bool get enabled =&gt; (flags &amp; ENABLED_FLAG) == ENABLED_FLAG;
</pre>
<pre class="source">
void set enabled(bool flag) {
 if (flag) {
   flags |= ENABLED_FLAG;
 } else {
   flags &amp;= ~ENABLED_FLAG;
 }
}
</pre>
</div>
</div>
<div class="field inherited"><h4 id="fixtureA">
<button class="show-code">Code</button>
<a href="../box2d/Fixture.html">Fixture</a>         <strong>fixtureA</strong> <a class="anchor-link"
            href="#fixtureA"
            title="Permalink to PolygonContact.fixtureA">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
fixtureA
</pre>
</div>
</div>
<div class="field inherited"><h4 id="fixtureB">
<button class="show-code">Code</button>
<a href="../box2d/Fixture.html">Fixture</a>         <strong>fixtureB</strong> <a class="anchor-link"
            href="#fixtureB"
            title="Permalink to PolygonContact.fixtureB">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
fixtureB
</pre>
</div>
</div>
<div class="field inherited"><h4 id="flags">
<button class="show-code">Code</button>
int         <strong>flags</strong> <a class="anchor-link"
            href="#flags"
            title="Permalink to PolygonContact.flags">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
flags
</pre>
</div>
</div>
<div class="field inherited"><h4 id="manifold">
<button class="show-code">Code</button>
<a href="../box2d/Manifold.html">Manifold</a>         <strong>manifold</strong> <a class="anchor-link"
            href="#manifold"
            title="Permalink to PolygonContact.manifold">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
manifold
</pre>
</div>
</div>
<div class="field inherited"><h4 id="next">
<button class="show-code">Code</button>
<a href="../box2d/Contact.html">Contact</a>         <strong>next</strong> <a class="anchor-link"
            href="#next"
            title="Permalink to PolygonContact.next">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
next
</pre>
</div>
</div>
<div class="field inherited"><h4 id="pool">
<button class="show-code">Code</button>
<a href="../box2d/DefaultWorldPool.html">DefaultWorldPool</a>         <strong>pool</strong> <a class="anchor-link"
            href="#pool"
            title="Permalink to PolygonContact.pool">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
pool
</pre>
</div>
</div>
<div class="field inherited"><h4 id="prev">
<button class="show-code">Code</button>
<a href="../box2d/Contact.html">Contact</a>         <strong>prev</strong> <a class="anchor-link"
            href="#prev"
            title="Permalink to PolygonContact.prev">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
prev
</pre>
</div>
</div>
<div class="field inherited"><h4 id="toiCount">
<button class="show-code">Code</button>
num         <strong>toiCount</strong> <a class="anchor-link"
            href="#toiCount"
            title="Permalink to PolygonContact.toiCount">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
toiCount
</pre>
</div>
</div>
<div class="field inherited"><h4 id="touching">
<button class="show-code">Code</button>
final bool         <strong>touching</strong> <a class="anchor-link"
            href="#touching"
            title="Permalink to PolygonContact.touching">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<p>Is this contact touching </p>
<pre class="source">
bool get touching =&gt; (flags &amp; TOUCHING_FLAG) == TOUCHING_FLAG;
</pre>
</div>
</div>
</div>
<div>
<h3>Methods</h3>
<div class="method"><h4 id="evaluate">
<button class="show-code">Code</button>
void <strong>evaluate</strong>(<a href="../box2d/Manifold.html">Manifold</a> argManifold, <a href="../box2d/Transform.html">Transform</a> xfA, <a href="../box2d/Transform.html">Transform</a> xfB) <a class="anchor-link" href="#evaluate"
              title="Permalink to PolygonContact.evaluate">#</a></h4>
<div class="doc">
<div class="inherited">
<p>Abstract method. </p>
<div class="docs-inherited-from">docs inherited from <a href="../box2d/Contact.html">Contact</a> </div></div>
<pre class="source">
void evaluate(Manifold argManifold, Transform xfA, Transform xfB) {
 pool.collision.collidePolygons(argManifold, fixtureA.shape, xfA,
     fixtureB.shape, xfB);
}
</pre>
</div>
</div>
<div class="method inherited"><h4 id="flagForFiltering">
<button class="show-code">Code</button>
void <strong>flagForFiltering</strong>() <a class="anchor-link" href="#flagForFiltering"
              title="Permalink to PolygonContact.flagForFiltering">#</a></h4>
<div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<p>Flag this contact for filtering. Filtering will occur the next time step.</p>
<pre class="source">
void flagForFiltering() {
 flags |= FILTER_FLAG;
}
</pre>
</div>
</div>
<div class="method inherited"><h4 id="getWorldManifold">
<button class="show-code">Code</button>
void <strong>getWorldManifold</strong>(<a href="../box2d/WorldManifold.html">WorldManifold</a> worldManifold) <a class="anchor-link" href="#getWorldManifold"
              title="Permalink to PolygonContact.getWorldManifold">#</a></h4>
<div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<p>Intializes the given world manifold.</p>
<pre class="source">
void getWorldManifold(WorldManifold worldManifold) {
 final Body bodyA = fixtureA.body;
 final Body bodyB = fixtureB.body;
 final Shape shapeA = fixtureA.shape;
 final Shape shapeB = fixtureB.shape;

 worldManifold.initialize(manifold, bodyA.originTransform,
     shapeA.radius, bodyB.originTransform, shapeB.radius);
}
</pre>
</div>
</div>
<div class="method"><h4 id="init">
<button class="show-code">Code</button>
void <strong>init</strong>(<a href="../box2d/Fixture.html">Fixture</a> fA, <a href="../box2d/Fixture.html">Fixture</a> fB) <a class="anchor-link" href="#init"
              title="Permalink to PolygonContact.init">#</a></h4>
<div class="doc">
<div class="inherited">
<p>Initialization for pooling.</p>
<div class="docs-inherited-from">docs inherited from <a href="../box2d/Contact.html">Contact</a> </div></div>
<pre class="source">
void init(Fixture fA, Fixture fB) {
 expect(ShapeType.POLYGON, fA.type);
 expect(ShapeType.POLYGON, fB.type);
 super.init(fA, fB);
}
</pre>
</div>
</div>
<div class="method inherited"><h4 id="update">
<button class="show-code">Code</button>
void <strong>update</strong>(<a href="../box2d/ContactListener.html">ContactListener</a> listener) <a class="anchor-link" href="#update"
              title="Permalink to PolygonContact.update">#</a></h4>
<div class="inherited-from">inherited from <a href="../box2d/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
void update(ContactListener listener) {
 _oldManifold.setFrom(manifold);

 // Re-enable this contact.
 flags |= ENABLED_FLAG;

 bool nowTouching = false;
 bool wasTouching = (flags &amp; TOUCHING_FLAG) == TOUCHING_FLAG;

 bool sensorA = fixtureA.isSensor;
 bool sensorB = fixtureB.isSensor;
 bool sensor = sensorA || sensorB;

 Body bodyA = fixtureA.body;
 Body bodyB = fixtureB.body;
 Transform xfA = bodyA.originTransform;
 Transform xfB = bodyB.originTransform;

 if (sensor) {
   Shape shapeA = fixtureA.shape;
   Shape shapeB = fixtureB.shape;
   nowTouching = pool.collision.testOverlap(shapeA, shapeB, xfA, xfB);

   // Sensors don't generate manifolds.
   manifold.pointCount = 0;
 } else {
   evaluate(manifold, xfA, xfB);
   nowTouching = manifold.pointCount &gt; 0;

   // Match old contact ids to new contact ids and copy the
   // stored impulses to warm start the solver.
   for (int i = 0; i &lt; manifold.pointCount; ++i) {
     ManifoldPoint mp2 = manifold.points[i];
     mp2.normalImpulse = 0.0;
     mp2.tangentImpulse = 0.0;
     ContactID id2 = mp2.id;

     for (int j = 0; j &lt; _oldManifold.pointCount; ++j) {
       ManifoldPoint mp1 = _oldManifold.points[j];

       if (mp1.id.isEqual(id2)) {
         mp2.normalImpulse = mp1.normalImpulse;
         mp2.tangentImpulse = mp1.tangentImpulse;
         break;
       }
     }
   }

   if (nowTouching != wasTouching) {
     bodyA.awake = true;
     bodyB.awake = true;
   }
 }

 if (nowTouching) {
   flags |= TOUCHING_FLAG;
 } else {
   flags &amp;= ~TOUCHING_FLAG;
 }

 if (listener == null) {
   return;
 }

 if (!wasTouching &amp;&amp; nowTouching) {
   listener.beginContact(this);
 }

 if (wasTouching &amp;&amp; !nowTouching) {
   listener.endContact(this);
 }

 if (sensor == false &amp;&amp; nowTouching) {
   listener.preSolve(this, _oldManifold);
 }
}
</pre>
</div>
</div>
</div>
        </div>
        <div class="clear"></div>
        </div>
        <div class="footer">
          
        </div>
        <script async src="../client-live-nav.js"></script>
        </body></html>
        
